package org.lex.game.sudoku.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Stack<T> implements Iterable<T> {
	private List<T> data = new ArrayList<T>();

	@Override
	public Iterator<T> iterator() {
		return this.data.iterator();
	}

	public boolean isEmpty() {
		return this.data.isEmpty();
	}

	public void push(T e) {
		this.data.add(e);
	}

	public T pop() {
		return this.data.remove(this.data.size() - 1);
	}

	public T peek() {
		return this.data.get(this.data.size() - 1);
	}

	public String toString() {
		return this.data.toString();
	}
}
